package com.linwen.excise.niuke._20;

import java.util.Scanner;

/**
 * @author wlw
 * @date 2023/3/3 10:16 PM
 */
public class _17坐标移动 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] split = str.split(";");
        int x = 0,y = 0;
        for (int i = 0; i < split.length; i++) {
            if(split[i].length()<2){
                continue;
            }

            String o = split[i].substring(0,1);
            String temp = split[i].substring(1, split[i].length());
            int step = 0;
            try{
                step = Integer.parseInt(temp);
            }catch (NumberFormatException exception){
                continue;
            }
            switch (o){
                case "A":
                    x -= step;
                    break;
                case "D":
                    x += step;
                    break;
                case "W":
                    y += step;
                    break;
                case "S":
                    y -= step;
                    break;
                default:
                    break;
            }
        }
        System.out.println(x+","+y);
    }
}
